<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<title></title>
		<link rel="stylesheet" href="../imgv2/css/default.min.css" />
		<link href="../imgv2/css/css.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" href="../jsv2/bootstrap/css/bootstrap-ico.css" />
		<link rel="stylesheet" href="../imgv2/icon/iconfont.css" />
		<style>
			.journey-base-info,
			.btns-info {
				/*height: 144px;*/
				
				background-color: rgba(150, 204, 112, 1);
				position: fixed;
				width: 100%;
				top: 0px;
				left: 0px;
				z-index: 200;
			}
			.address-info,
			.time-info,
			.location-info {
				height: 48px;
				color: rgba(255, 255, 255, 1);
			}
			.btns-info {
				top: 144px;
				height: 22px;
				width: 100%;
				text-align: center;
				background-color: rgba(255, 255, 255, 0);
				margin: auto;
				transition: All 0.4s ease-in-out;
				-webkit-transition: All 0.4s ease-in-out;
				-moz-transition: All 0.4s ease-in-out;
				-o-transition: All 0.4s ease-in-out;
			}
			.btns-info.hide {
				top: 36px;
			}
			.btns-info i {
				display: inline-block;
				width: 30%;
				background-color: rgba(150, 204, 112, 1);
				line-height: 22px;
				top: 0px;
				border-bottom-left-radius: 5px;
				border-bottom-right-radius: 5px;
			}
			.photo-img {
				height: 40px;
				width: 40px;
				margin: 0px;
				border-radius: 3px;
				margin-left: 3px;
				margin-right: 3px;
				margin-top: 4px;
			}
			.address-info>table {
				width: 100%;
				height: inherit;
				display: inherit;
			}
			.address-info tr {
				height: 24px;
				line-height: 24px;
			}
			.address-info td {
				height: inherit;
				line-height: inherit;
			}
			.td1 {
				width: 20%;
			}
			.td2 {
				width: 60%;
			}
			.time-info {
				border-top: 1px solid rgba(255, 255, 255, .5);
				border-bottom: 1px solid rgba(255, 255, 255, .5);
			}
			.time-info>div {
				float: left;
				width: 50%;
				text-align: left;
				height: 38px;
				margin-top: 5px;
				margin-bottom: 5px;
			}
			.time-info span,
			.location-info span {
				display: inline-block;
				width: 100%;
				line-height: 19px;
			}
			.endtime {
				border-left: 1px solid rgba(255, 255, 255, 1);
				padding-left: 10px;
			}
			.label-title {
				font-size: 12px;
			}
			.has-hide {
				display: none;
			}
			#iCenter {
				height: 100%;
				width: 100%;
				margin-top: 36px;
			}
			.location-info.hide {
				height: 36px;
			}
			.location-info.hide .label-title {
				display: none;
			}
			.location-info.hide span {
				line-height: 36px;
			}
			.btns-bottom-list {
				height: 42px;
				position: fixed;
				left: 2.5%;
				bottom: 10px;
				background-color: rgba(255, 255, 255, 1);
				width: 95%;
				padding: 3px;
				box-shadow: 1px 1px 2px rgba(222, 222, 222, 1), -1px -1px 2px rgba(222, 222, 222, 1);
				border-radius: 3px;
				z-index: 999;
				/*border: 1px solid rgba(222,222,222,1);*/
			}
			.btns-bottom-list span,
			.btns-item-soundrecording em {
				display: inline-block;
				width: 28%;
				line-height: 36px;
				text-align: center;
				border-radius: 3px;
				white-space: nowrap;
			}
			.btns-bottom-list .btns-item-soundrecording {
				width: 40%;
			}
			.btns-item-friend.selected,
			.btns-item-soundrecording.selected em,
			.btns-item-conversation.selected,
			.btns-item-friend:hover,
			.btns-item-soundrecording em:hover,
			.btns-item-conversation:hover {
				background-color: rgba(150, 204, 112, 1);
			}
			.btns-item-conversation.new-conversation.has-new:after {
				content: '';
				width: 10px;
				height: 10px;
				background-color: rgba(255, 0, 0, 1);
				border-radius: 50%;
				position: absolute;
				margin-top: 5px;
				margin-left: 5px;
			}
			.btns-item-soundrecording {
				border-left: 1px solid rgba(222, 222, 222, 1);
				border-right: 1px solid rgba(222, 222, 222, 1);
			}
			.btns-item-soundrecording em {
				display: inherit;
				height: inherit;
				line-height: inherit;
				width: 92%;
			}
			/**下面弹出文本**/
			
			.up-list {
				height: 0%;
				width: 100%;
				position: fixed;
				z-index: 9999;
				bottom: 0%;
				left: 0%;
				background-color: rgba(255, 255, 255, 1);
				padding: 0px;
				transition: All 0.4s ease-in-out;
				-webkit-transition: All 0.4s ease-in-out;
				-moz-transition: All 0.4s ease-in-out;
				-o-transition: All 0.4s ease-in-out;
			}
			.up-list-title {
				height: 28px;
				background-color: rgba(150, 204, 112, 1);
			}
			.up-list-title span {
				display: inline-block;
				width: 50%;
				float: left;
				line-height: 28px;
			}
			.up-list-title-txt {
				text-indent: 1em;
				color: rgba(255, 255, 255, 1);
			}
			.up-list-title-close {
				text-align: right;
				padding-right: 10px;
				cursor: pointer;
				color: rgba(255, 255, 255, 1);
			}
			.up-list-content {
				background-color: rgba(255, 255, 255, 1);
				overflow: hidden;
				overflow-y: auto;
				height: 90%;
				width: 100%;
			}
			.new-conversation-status .call-item {
				height: 32px;
				width: 100%;
				margin-left: 10px;
			}
			.new-conversation-status .call-item:first-child {
				margin-top: 8px;
			}
			.new-conversation-status .call-item.right {
				text-align: right;
				margin-left: -10px;
			}
			.new-conversation-status .call-item img {
				height: 28px;
				width: 28px;
				line-height: 28px;
				border-radius: 3px;
				vertical-align: middle;
			}
			.new-conversation-status .call-item span {
				display: inline-block;
				line-height: 28px;
				height: 28px;
				width: 35%;
			}
			.time {
				color: rgba(156, 156, 156, 1);
				/*position: absolute;*/
				
				font-size: 12px;
				text-indent: 1em;
			}
			.video {
				background-color: rgba(150, 204, 112, 1);
				margin-left: 10px;
				border-radius: 3px;
			}
			/*.video:before {
				content: '';
				width: 10px;
				height: 10px;
				background-color: rgba(150, 204, 112, 1);
				position: absolute;
				margin-left: -3px;
				margin-top: 8px;
				-moz-transform: rotate(45deg);
				-webkit-transform: rotate(45deg);
				-o-transform: rotate(45deg);
				transform: rotate(45deg);
			}*/
			
			.video i {
				display: inline-block;
				width: 44%;
				height: inherit;
				background-repeat: no-repeat;
			}
			.video .video-text {
				/*background-image: url(../imgv2/video-m.png);
							background-position: 10px center;*/
				
				padding-left: 10px;
				color: rgba(255, 255, 255, 1);
			}
			.video .video-btn {
				/*background-image: url(../imgv2/play-m.png);
							background-position: right center;*/
				
				color: rgba(255, 255, 255, 1);
				text-align: right;
			}
			.new-conversation-status .call-item.right .video-text {
				/*background-image: url(../imgv2/video-o.png);
							background-position: right center;*/
				
				color: rgba(0, 0, 0, 1);
				text-align: right;
			}
			.new-conversation-status .call-item.right .video-btn {
				/*background-image: url(../imgv2/play-o.png);
							background-position: left center;*/
				
				color: rgba(0, 0, 0, 1);
				text-align: left;
			}
			.call-item.right .video {
				background-color: rgba(241, 241, 241, 1);
				margin-right: 10px;
				padding-right: 10px;
			}
			/*.call-item.right .video:before {
				content: '';
				width: 0px;
				height: 0px;
			}
			.call-item.right .video:after {
				content: '';
				width: 10px;
				height: 10px;
				background-color: rgba(241, 241, 241, 1);
				position: absolute;
				margin-left: 3px;
				margin-top: 8px;
				-moz-transform: rotate(45deg);
				-webkit-transform: rotate(45deg);
				-o-transform: rotate(45deg);
				transform: rotate(45deg);
			}*/
			
			.call-item.right .time {
				position: inherit;
			}
			.iconfont {
				margin-right: 5px;
			}
			.friend-items {
				height: 48px;
				padding-left: 10px;
				vertical-align: middle;
			}
			.friend-items img {
				width: 36px;
				line-height: 36px;
				border-radius: 3px;
				margin-top: 6px;
			}
			.friend-items span {
				display: inline-block;
				height: 48px;
			}
			.friend-items i {
				display: inline-block;
				width: 100%;
				line-height: 18px;
			}
			.friend-items-info {
				border-bottom: 1px solid rgba(208, 208, 208, 1);
				width: 80%;
				padding-left: 5px;
			}
			.friend-items-info .friend-items-status {
				font-size: 12px;
				color: rgba(208, 208, 208, 1);
			}
			.friend-items:hover {
				background-color: rgba(255, 211, 179, 1);
			}
			.voice_btn {
				width: 100px;
				background-color: #1e1e1e;
				border-top-style: none;
				border-right-style: none;
				border-bottom-style: none;
				border-left-style: none;
				color: #FFF;
				height: 60px;
				line-height: 60px;
				font-size: 13px;
			}
			.popup {
				background-color: #1e1e1e;
				margin-right: auto;
				margin-left: auto;
				border: 1px solid #8d8d8d;
				width: 90%;
				overflow: auto;
				position: absolute;
				z-index: 99;
				left: 4%;
				top: 10%;
			}
			.disable {
				filter: gray;
				-moz-opacity: 0.3;
				opacity: 0.3;
			}
			.user_popup {
				height: 4rem;
			}
			.user_popup .user_img {
				width: 6rem;
				padding: 6px;
				text-align: center;
				margin-top: -16px;
				margin-left: -8px;
				border-radius: 8px;
				margin-bottom: 89px;
				box-shadow: 1px 1px 1px rgba(222, 222, 222, 1), -1px -1px 1px rgba(222, 222, 222, 1);
				border: 1px solid rgba(222, 222, 222, 1);
			}
			.user_popup .user_img:after {
				content: '';
				width: 12px;
				height: 12px;
				margin-left: -6px;
				margin-top: 0px;
				position: absolute;
				-moz-transform: rotate(45deg);
				-webkit-transform: rotate(45deg);
				-o-transform: rotate(45deg);
				transform: rotate(45deg);
				box-shadow: 1px 1px 2px rgba(222, 222, 222, 1);
			}
			.user_img p {
				/*margin-top: 8px;*/
				
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
				font-size: 12px;
			}
			.user_img .user_popup_name {
				margin-bottom: 4px;
				margin-top: 0px;
			}
			.user_img_blue,
			.user_img_blue:after {
				background-color: rgba(41, 163, 204, 1);
				color: rgba(255, 255, 255, 1);
			}
			.user_img_normal,
			.user_img_normal:after {
				background-color: rgba(255, 255, 255, 1);
			}
			.call-item .video-text {
				margin-left: -9px;
				text-indent: 5px;
				background: url(../imgv2/message_box_green.png) no-repeat left center;
			}
			.call-item.right .video-text {
				margin-right: -18px;
				padding-right: 20px;
				background: url(../imgv2/message_box_gray.png) no-repeat right center;
			}
			.current-location {
				position: absolute;
				left: 10px;
				bottom: 80px;
				cursor: pointer;
			}
			.current-location i {
				font-size: 4rem;
			}
		</style>
	</head>

	<body>
		<div class="journey-base-info">
			<div class="address-info has-hide">
				<table cellpadding="0" cellspacing="0">
					<tr>
						<td rowspan="2" class="td1">
							<img class="photo-img" />
						</td>
						<td class="td2"><span class="address-detail-title"><em
							id="owner-name">永远的永远</em>&nbsp;&nbsp;创建了</span>
						</td>
						<!--<td rowspan="2" class="td3">
							<p id="tripStatusBar" class="status_green greenline">旅程进行中</p>
						</td>-->
					</tr>
					<tr>
						<td><span class="address-detail-info"> <!--<i class="glyphicon glyphicon-map-marker"></i>-->
							<em id="trip-title">黄河路11号</em>
					</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="time-info has-hide">
				<div class="starttime">
					<span class="label-title">开始时间</span> <span id="txtJourneyStartTime">2015-05-01</span>
				</div>
				<div class="endtime">
					<span class="label-title">结束时间</span> <span id="txtJourneyEndTime">2015-05-01</span>
				</div>
			</div>
			<div class="location-info hide">
				<span class="label-title">目的地</span> <span><i
				class="glyphicon glyphicon-map-marker"></i><em
				id="txtJourneyDestination">人民广场(东门)</em></span>
			</div>
		</div>
		<div class="btns-info hide">
			<i class="glyphicon glyphicon-triangle-top"></i>
		</div>
		<div id="iCenter"></div>
		<div id="currentLocation" class="current-location"><i class="iconfont">&#xe601;</i>
		</div>
		<div class="btns-bottom-list">
			<span class="btns-item-friend" target="friend-list-status"><i class="icon iconfont">&#xe604;</i><i class="btn-name">好友</i></span>
			<span id="startRecord" data-status="startrecord" class="btns-item-soundrecording"><em><i class="icon iconfont">&#xe609;</i><i class="btn-name">录音</i></em></span>
			<span class="btns-item-conversation new-conversation" target="new-conversation-status"><i class="icon iconfont">&#xe608;</i><i class="btn-name">会话</i></span>
		</div>
		<div class="up-list friend-list-status">
			<div class="up-list-title">
				<span class="up-list-title-txt">好友</span> <span class="up-list-title-close"><i class="icon iconfont" target="friend-list-status">&#xe602;</i></span>
			</div>
			<div class="up-list-content friend-status">
				<!--<div class="friend-items">
					<img src="../imgv2/fbb.jpg">
					<span class="friend-items-info">
					<i class="friend-items-name">张杰</i>
					<i class="friend-items-status">在线</i>
				</span>
				</div>-->
			</div>
		</div>
		<div class="up-list new-conversation-status">
			<div class="up-list-title">
				<span class="up-list-title-txt">会话</span> <span class="up-list-title-close"><i class="icon iconfont" target="new-conversation-status">&#xe602;</i></span>
			</div>
			<div class="up-list-content new-conversation">
				<!--<div class="call-item">
					<img src="../imgv2/fbb.jpg" /><span class="video"><i class="video-text icon iconfont">&#xe60b;</i><i class="video-btn icon iconfont">&#xe605;</i></span><span class="time">下午5：30</span>
				</div>
				<div class="call-item">
					<img src="../imgv2/fbb.jpg" /><span class="video"><i class="video-text icon iconfont">&#xe60b;</i><i class="video-btn icon iconfont">&#xe605;</i></span><span class="time">下午5：30</span>
				</div>
				<div class="call-item right">
					<span class="time">下午5：30</span><span class="video"><i class="video-btn icon iconfont">&#xe605;</i><i class="video-text icon iconfont">&#xe60a;</i></span>
					<img src="../imgv2/fbb.jpg" />
				</div>-->
			</div>
		</div>
	</body>
	<script src="../jsv2/jquery-1.10.1.min.js"></script>
	<script src="http://webapi.amap.com/maps?v=1.3&key=57c58c7b1f94514317df97e3a985962c"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script src="../jsv2/QueryStringParser.js"></script>
	<script src="../jsv2/AMapCommon.js"></script>
	<script src="../jsv2/jsonMsg.js"></script>
	<script src="../jsv2/lib/k-utils-fn.js"></script>
	<script src="../jsv2/journey/operateData.js"></script>
	<script>
		var openId, tripId, pageURL, kmap, memberHashList = {},
			tripStatus = 1,
			currentUserIcon, timeIntervalClock /*计时时钟*/ , timeCountDown = 55, //录音时倒计时
			newsVoiceID /*最新一条语音ID*/ ;
		var mapObj, geolocation, markerFF, markers = [],
			geoSuccessListener, geoErrorListener;
		var toolBar;
		var lastMemberLocList = [];
		var locationInfo;
		var windowsArr = [];
		var marker = [];
		var memberList = [];
		var latLon = "";
		var lat_me = "";
		var lon_me = "";
		var isLeaderFlag = false;
		var customMarker = new AMap.Marker({
			offset: new AMap.Pixel(-14, -34), //相对于基点的位置
			icon: new AMap.Icon({ //复杂图标
				size: new AMap.Size(27, 36), //图标大小
				image: "http://webapi.amap.com/images/custom_a_j.png", //大图地址
				imageOffset: new AMap.Pixel(-28, 0) //相对于大图的取图位置
			})
		});
		var nickName, imageURL;
		$(function() {
			showMaskLoading();
			openId = queryString.getParam("openid");
			tripId = queryString.getParam("tripid");
			$('.btns-info').on('click', function() {
				if ($('.has-hide').is(':visible')) {
					$('.has-hide').slideUp();
					$('.location-info').addClass('hide');
					$('.btns-info').addClass('hide');
					$('.btns-info i').removeClass('glyphicon-triangle-top').addClass('glyphicon-triangle-bottom');
				} else {
					$('.has-hide').slideDown();
					$('.location-info').removeClass('hide');
					$('.btns-info').removeClass('hide');
					$('.btns-info i').removeClass('glyphicon-triangle-bottom').addClass('glyphicon-triangle-top');
				}
			});
			$('#iCenter').css({
				'height': (K.getPageSize()[1] - 36) + 'px'
			});
			/*kmap = new KAMap({
				render: 'iCenter'
			});
			kmap.mapInit(null, function() {
				var endmarker = new AMap.Marker({
					icon: new AMap.Icon({ //复杂图标
						image: "img/dis_icon.png" //大图地址
					})
				});
				endmarker.setPosition(null);
				endmarker.setMap(kmap.mapObj);
			});*/
			pageURL = location.href.split('#')[0];
			if (openId == null || openId == "") {
				closemaskLoading(); //关闭这招层
				return false;
			} else {
				//setMenu(openId, tripId);
				fillTripInfo(openId, tripId);
				loadWechatVoice();
			}
			$('.btns-bottom-list span[target]').on('click', function(e) {
				var tar = $(e.target),
					tg = tar.attr('target');
				tg = tg ? tg : tar.parent().attr('target');
				$('.' + tg).css({
					'height': '45%'
				});
				$('.up-list-content', $('.' + tg)).css({
					'height': document.body.clientHeight * .45 + 'px'
				});
				if (tg == 'new-conversation-status') {
					fetchVoiceList();
				}
			});
			$('.up-list-title-close').on('click', function(e) {
				var tar = $(e.target),
					tg = tar.attr('target');
				tg = tg ? tg : tar.parent().attr('target');
				$('.up-list.' + tg).css({
					'height': '0%'
				});
			});
			//选中某个用户就将该用户定位到中心点
			$(document).on('click', '.up-list-content.friend-status .friend-items', function(e) {
				var tar = $(e.target);
				tar = _getTarparanetByClass(tar, 'friend-items');
				var userInfo = tar.data('user');
				userInfo ? setMapCenterByOpneID(userInfo.OpenID) : '';
			});
			$('#currentLocation').attr({
				'OpenID': openId
			}).on('click', function(e) {
				var tar = $(e.target);
				tar = _getTarparanetByClass(tar, 'current-location');
				var oid = tar.attr('OpenID');
				oid ? setMapCenterByOpneID(oid) : '';
			});
		});
		/**
		 * 将地图定位到指定用户中心
		 * @param {Object} oid 用户ID
		 */
		function setMapCenterByOpneID(oid) {
			if (lastMemberLocList && oid) {
				for (var i = 0, l = lastMemberLocList.length; i < l; i++) {
					if (lastMemberLocList[i].OpenID == oid) { //将指定用户定位但中间
						mapObj.setZoomAndCenter(15, new AMap.LngLat(lastMemberLocList[i].Loc.Longitude / 1000000, lastMemberLocList[i].Loc.Latitude / 1000000));
						break;
					}
				}
			}
		}

		function setLocation() {
				if (geolocation) {
					geolocation.getCurrentPosition();
					//geolocation.watchPosition();
				} else {
					setTimeout(setLocation, 1000);
				}
			}
			//获取团员地址时，如果某个人团员下线了，则把头像从地图上移除掉

		function deleteNotInMarkers(memberData) {
				var flag = true;
				for (var i = 0, j = markers.length; i < j; i++) {
					var m = markers[i];
					flag = true;
					for (var _i = 0, _j = memberData.length; _i < _j; _i++) {
						var md = memberData[_i];
						if (m.getTitle() === md.OpenID) {
							flag = false;
							break;
						}
					}
					if (flag) {
						m.setMap(null);
					}
				}
			}
			//显示所有人的位置头像

		function showAllPositions(allPositions) {
				for (var i = 0, j = allPositions.length; i < j; i++) {
					var mP = allPositions[i];
					if (mP.Loc.Longitude != "0" && mP.Loc.Latitude != "0" && mP.OpenID != openId) {
						var headImg = "";
						var nickNm = "";
						var deepstatus = 'mrn';
						var isLeader = false;
						for (var k = 0; k < memberList.length; k++) {
							if (memberList[k].OpenID == mP.OpenID) {
								headImg = memberList[k].ImageURL;
								nickNm = memberList[k].Nickname;
								deepstatus = memberList[k].DeepStatus; //获取类型mobile为手机,mrn为汽车
								break;
							}
						}
						if (tripLeaderId == mP.OpenID) {
							isLeader = true;
						}
						setMemberLocation(mP.OpenID, mP.Loc.Longitude / 1000000, mP.Loc.Latitude / 1000000, headImg, isLeader, 20, nickNm, deepstatus);
					}
				}
			}
			//当开着这个页面的时候，上传位置信息

		function updateMemberPositions(_lat, _lng) {
				var loc = {
					Latitude: 29.579916,
					Longitude: 115.98905
				};
				loc.Latitude = parseFloat(_lat) * 1000000;
				loc.Longitude = parseFloat(_lng) * 1000000;
				var dynamicInfo = {
					ActiveTripID: tripId,
					Loc: loc
				};
				var dataStr = {
					DynamicInfo: dynamicInfo
				};
				bidgeToWeixin(openId, 'DynamicInfoTrip', dataStr, function(data, status, xhr) {
					//Do Anything After get Return data  
					lastMemberLocList = data.portalResp.Data;
					data && data.portalResp && data.portalResp.Data ? showAllPositions(data.portalResp.Data) : '';
					//deleteNotInMarkers(data.portalResp.Data);		
				});
			}
			/*function showPicClickLoc() {
				console.log('showPicClickLoc', lastMemberLocList);
				for (var i = 0, j = lastMemberLocList.length; i < j; i++) {
					var mP = lastMemberLocList[i];
					//if (mP.Loc.Longitude != "0" && mP.Loc.Latitude != "0" && mP.OpenID != openId) {
					if (mP.Loc.Longitude != "0" && mP.Loc.Latitude != "0") {
						if (document.getElementById(mP.OpenID)) {
							var js = "mapObj.setZoomAndCenter(15, new AMap.LngLat(mP.Loc.Longitude/1000000,mP.Loc.Latitude/1000000));";
							// creates a function from the "js" string
							var newclick = eval("(function(){" + js + "});");
							// clears onclick then sets click
							$("#" + mP.OpenID).attr('onclick', '').click(newclick);
							$("#" + mP.OpenID).removeClass('disable');
						}
						//setMemberLocation(mP.OpenID, mP.Loc.Longitude/1000000, mP.Loc.Latitude/1000000, headImg, isLeader, 20,nickNm);
					}
				}
			}*/

		function geoInit(isCenter) {
			geolocation = new AMap.Geolocation({
				enableHighAccuracy: true, //是否使用高精度定位，默认:true  
				timeout: 100000, //超过10秒后停止定位，默认：无穷大  
				maximumAge: 0, //定位结果缓存0毫秒，默认：0  
				convert: true, //自动偏移坐标，偏移后的坐标为高德坐标，默认：true  
				showButton: false, //显示定位按钮，默认：true  
				buttonPosition: 'LB', //定位按钮停靠位置，默认：'LB'，左下角  
				buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)  
				showMarker: true, //定位成功后在定位到的位置显示点标记，默认：true  
				markerOptions: {
					title: "locationIMG",
					offset: {
						x: -10,
						y: 20
					},
					icon: new AMap.Icon({
						//image: "http://webapi.amap.com/theme/v1.2/my_location.png",
						image: '../imgv2/pin_car.png',
						size: new AMap.Size(60, 60),
						imageOffset: {
							//x: -24,
							x: 0,
							y: -2
						}
					})
				},
				showCircle: false, //定位成功后用圆圈表示定位精度范围，默认：true  
				panToLocation: isCenter, //定位成功后将定位到的位置作为地图中心点，默认：true  
				zoomToAccuracy: true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false  
			});
			mapObj.addControl(geolocation);
			geoSuccessListener = AMap.event.addListener(geolocation, 'complete', OnComplete); //返回定位信息,初始时定位后设为地图中心点  
			geoErrorListener = AMap.event.addListener(geolocation, 'error', onError); //返回定位出错信息  
		}

		function geoRemove() {
			mapObj.removeControl(geolocation);
			AMap.event.removeListener(geoSuccessListener);
			AMap.event.removeListener(geoErrorListener);
			if ($("div[title='locationIMG']")) {
				$("div[title='locationIMG']").parent().remove();
			}
		}

		function mapInit(center) {
			mapObj = new AMap.Map('iCenter', {
				level: 15
			});
			mapObj.plugin(["AMap.ToolBar"], function() {
				toolBar = new AMap.ToolBar();
				mapObj.addControl(toolBar);
			});
			mapObj.plugin('AMap.Geolocation', function() {
				geoInit(false);
			});
			AMap.event.addListener(mapObj, 'dragstart', function(e) { //移动地图后再定位时不设为地图中心点
				geoRemove();
				geoInit(false);
				setLocation()
			});
			//var pageURL = location.href.split('#')[0];
			//pageURL = pageURL.substring(0,pageURL.indexOf("trip_voice"))+
			//终点
			var endmarker = new AMap.Marker({
				icon: new AMap.Icon({ //复杂图标
					image: "../imgv2/dis_icon.png" //大图地址
				})
			});
			endmarker.setPosition(center);
			endmarker.setMap(mapObj);
			mapObj.setZoomAndCenter(14, center);
		};

		function getExistsInMarkers(titleOpenID) {
			for (var i = 0; i < markers.length; i++) {
				var m = markers[i];
				if (m.getTitle() === titleOpenID) {
					return m;
				}
			}
			return null;
		}

		function setMemberLocation(_oID, _lng, _lat, _imageUrl, _isLeader, currentMember, nickNameIn, deepstatus) {
			var _m = getExistsInMarkers(_oID);
			_m ? _m.setMap(null) : '';
			if (_m) {
				if (currentMember > 1) {
					_m.setzIndex(currentMember);
				}
				_m.setMap(mapObj);
				_m.setPosition(new AMap.LngLat(_lng, _lat));
			} else {
				deepstatus = (deepstatus ? deepstatus : 'mrn') == 'mrn' ? 'pin_car' : 'pin_phone';
				var marker = new AMap.Marker({
					icon: '../imgv2/' + deepstatus + '.png',
					position: new AMap.LngLat(_lng, _lat),
					title: _oID
				});
				//自定义点标记内容     
				var markerContent = document.createElement("div");
				markerContent.className = "user_popup";
				//头像
				var markerContentDiv2 = document.createElement("div");
				if (_isLeader) {
					markerContentDiv2.className = "user_img user_img_blue";
				} else {
					markerContentDiv2.className = "user_img user_img_normal";
				}
				var markerP2 = document.createElement("p");
				var markerImg2 = document.createElement("img");
				markerImg2.src = _imageUrl !== null && _imageUrl !== "" && _imageUrl != undefined ? _imageUrl : "../imgv2/friend_pic.png";
				markerImg2.width = 50;
				markerImg2.height = 50;
				markerP2.appendChild(markerImg2);
				markerContentDiv2.appendChild(markerP2);
				//var markerP22 = document.createElement("p");
				//markerP22.className = "user_popup_name";
				//markerP22.innerHTML = nickNameIn;
				//markerContentDiv2.appendChild(markerP22);
				markerContent.appendChild(markerContentDiv2);
				//向下的箭头不需要
				/*var markerContentDiv3 = document.createElement("div");
				markerContentDiv3.className = "downarrow";
				var markerImg3 = document.createElement("img");
				if (_isLeader) {
					markerImg3.src = "../imgv2/arrow_popup_blue.png";
				} else {
					markerImg3.src = "../imgv2/arrow_popup.png";
				}
				markerContentDiv3.appendChild(markerImg3);
				markerContent.appendChild(markerContentDiv3);*/
				if (currentMember > 1) {
					marker.setzIndex(currentMember);
				}
				//marker.setTitle(_oID)
				marker.setContent(markerContent); //更新点标记内容
				//marker.setPosition(new AMap.LngLat(_lng, _lat)); //更新点标记位置
				marker.setMap(mapObj);
				//mapObj.setZoomAndCenter(14, new AMap.LngLat(_lng, _lat));
				mapObj.setFitView();
				//console.log(marker, mapObj,geolocation);
				markers.push(marker);
			}
		}

		function OnComplete(data) {
				lat_me = data.position.getLat();
				lon_me = data.position.getLng();
				setMemberLocation(openId, data.position.getLng(), data.position.getLat(), imageURL, tripLeaderId == openId ? true : false, 20, nickName, 'mrn');
				updateMemberPositions(data.position.getLat(), data.position.getLng());
			}
			/* 
			 *解析定位错误信息
			 */

		function onError(data) {
			var str = '定位失败,';
			str += '错误信息：'
			switch (data.info) {
				case 'PERMISSION_DENIED':
					str += '浏览器阻止了定位操作';
					break;
				case 'POSITION_UNAVAILBLE':
					str += '无法获得当前位置';
					break;
				case 'TIMEOUT':
					str += '定位超时';
					break;
				default:
					str += '未知错误';
					break;
			}
			updateMemberPositions(0, 0);
			setLocation();
		};
		 //输入提示
		function autoSearch() {}
			//输出输入提示结果的回调函数

		function autocomplete_CallBack(data) {}
			//输入提示框鼠标滑过时的样式

		function openMarkerTipById(pointid, thiss) { //根据id打开搜索结果点tip 
				thiss.style.background = '#CAE1FF';
			}
			//输入提示框鼠标移出时的样式

		function onmouseout_MarkerStyle(pointid, thiss) { //鼠标移开后点样式恢复 
				thiss.style.background = "";
			}
			//从输入提示框中选择关键字并查询

		function selectResult(index) {}
			//定位选择输入提示关键字

		function focus_callback() {
				/*if (navigator.userAgent.indexOf("MSIE") > 0) {
					document.getElementById("keyword").onpropertychange = autoSearch;
				}*/
			}
			//输出关键字查询结果的回调函数

		function placeSearch_CallBack(data) {}
			//鼠标滑过查询结果改变背景样式，根据id打开信息窗体

		function openMarkerTipById1(pointid, thiss) {
				thiss.style.background = '#CAE1FF';
				windowsArr[pointid].open(mapObj, marker[pointid]);
			}
			//添加查询结果的marker&infowindow   

		function addmarker(i, d) {
				var lngX = d.location.getLng();
				var latY = d.location.getLat();
				var markerOption = {
					map: mapObj,
					icon: "http://webapi.amap.com/images/" + (i + 1) + ".png",
					position: new AMap.LngLat(lngX, latY)
				};
				var mar = new AMap.Marker(markerOption);
				marker.push(new AMap.LngLat(lngX, latY));
				var infoWindow = new AMap.InfoWindow({
					content: "<h3><font color=\"#00a6ac\">  " + (i + 1) + ". " + d.name + "</font></h3>" + TipContents(d.type, d.address, d.tel),
					size: new AMap.Size(300, 0),
					autoMove: true,
					offset: new AMap.Pixel(0, -30)
				});
				windowsArr.push(infoWindow);
				var aa = function(e) {
					infoWindow.open(mapObj, mar.getPosition());
				};
				AMap.event.addListener(mar, "click", aa);
			}
			/**
			 * 修改结束行程操作已经移除出去了
			 */

		function popMore() {
			/*if (tripLeaderId == openId) {
				if (document.getElementById("dropbox").style.display == 'none') {
					document.getElementById("dropbox").style.display = "";
				} else {
					document.getElementById("dropbox").style.display = "none";
				}
			}*/
		}

		function uploadVoiceId(voiceId) {
			var dataStr = {
				"TripID": parseInt(tripId, 10),
				"VoiceType": 1,
				"VoiceID": voiceId
			};
			bidgeToWeixin(openId, 'UploadVoice', dataStr, function(data, status, xhr) {
				//alert("上传语音成功!");
			});
		}
		var voice = {
			localId: '',
			serverId: ''
		};

		function startVoice(voiceId) {
			voice.serverId = voiceId;
			wx.downloadVoice({
				serverId: voice.serverId,
				success: function(res) {
					voice.localId = res.localId;
					if (voice.localId == '') {
						alert('没有最新的语音信息！');
						return;
					}
					wx.playVoice({
						localId: voice.localId
					});
				}
			});
		}

		function loadWechatVoice() {
			var dataStr = {
				PageURL: pageURL
			};
			bidgeToWeixin(openId, 'JSSignature', dataStr, function(data, status, xhr) {
				var voiceData = data && data.portalResp && data.portalResp.Data;
				if (!voiceData) {
					return false;
				}
				var timestamp = voiceData.timestamp;
				var noncestr = voiceData.noncestr;
				var signature = voiceData.signature;
				var appId = voiceData.appId;
				wx.config({
					debug: false,
					appId: appId,
					timestamp: timestamp,
					nonceStr: noncestr,
					signature: signature,
					jsApiList: [
						'hideOptionMenu',
						'showOptionMenu',
						'stopRecord',
						'onRecordEnd',
						'playVoice',
						'pauseVoice',
						'stopVoice',
						'uploadVoice',
						'downloadVoice',
						'startRecord'
					]
				});
				wx.ready(function() {
					wx.hideOptionMenu();
					enableWechatJS();
				});
				wx.error(function(res) {
					alert(res.errMsg);
				});
			});
		}

		function enableWechatJS() {
			wx.ready(function() {
				// 4 音频接口
				// 4.2 开始录音
				$('#startRecord').on('click', function(e) {
					var tar = $(e.target);
					tar = _getTarparanetByClass(tar, 'btns-item-soundrecording');
					var btnStatus = tar.attr('data-status');
					if (btnStatus == 'startrecord') {
						$('.btn-name', tar).html("停止录音");
						tar.attr({
							'data-status': 'stoprecord'
						});
						updateCountdown(); //开始调用
						timeIntervalClock = setInterval(updateCountdown, 1000);
						wx.startRecord({
							cancel: function() {
								alert('用户拒绝授权录音');
							}
						});
					} else {
						$('.btn-name', tar).html("录音");
						tar.attr({
							'data-status': 'startrecord'
						});
						timeCountDown = 55;
						clearInterval(timeIntervalClock);
						wx.stopRecord({
							success: function(res) {
								voice.localId = res.localId;
								if (voice.localId == '') {
									alert('请先点击开始录音按钮录制一段声音');
									return;
								}
								wx.uploadVoice({
									localId: voice.localId,
									isShowProgressTips: 1, // 默认为1，显示进度提示
									success: function(res) {
										//alert('上传语音成功，serverId 为' + res.serverId);
										voice.serverId = res.serverId;
										uploadVoiceId(res.serverId);
									}
								});
							},
							fail: function(res) {
								alert(JSON.stringify(res));
							}
						});
					}
				});
				/*document.querySelector('#startRecord').onclick = function(e) {
					document.getElementById("stopRecordDiv").style.display = "";
					document.getElementById("uploadVoiceDiv").style.display = "none";
					document.getElementById("startRecordDiv").style.display = "none";
					document.querySelector('#startRecord').innerHTML="停止录音";
					wx.startRecord({
						cancel: function() {
							alert('用户拒绝授权录音');
						}
					});
				};*/
				// 4.3 停止录音
				/*document.querySelector('#stopRecord').onclick = function() {
					document.getElementById("stopRecordDiv").style.display = "none";
					document.getElementById("uploadVoiceDiv").style.display = "none";
					document.getElementById("startRecordDiv").style.display = "";
					wx.stopRecord({
						success: function(res) {
							voice.localId = res.localId;
							if (voice.localId == '') {
								alert('请先点击开始录音按钮录制一段声音');
								return;
							}
							wx.uploadVoice({
								localId: voice.localId,
								isShowProgressTips: 1, // 默认为1，显示进度提示
								success: function(res) {
									//alert('上传语音成功，serverId 为' + res.serverId);
									voice.serverId = res.serverId;
									uploadVoiceId(res.serverId);
								}
							});
						},
						fail: function(res) {
							alert(JSON.stringify(res));
						}
					});
				};*/
				// 4.4 监听录音自动停止
				wx.onVoiceRecordEnd({
					complete: function(res) {
						voice.localId = res.localId;
						alert('录音时间已超过一分钟');
					}
				});
				// 4.5 播放音频,界面上已经没有这个按钮了
				/*document.querySelector('#playVoiceStart').onclick = function() {
					var dataStr = {
						"TripID": parseInt(tripId, 10),
						"VoiceType": 1,
						"Cursor": 0,
						"Limit": 1,
						"OpenID": openId
					};
					bidgeToWeixin(openId, 'ListVoice', dataStr, function(data, status, xhr) {
						if (data.portalResp.Data.Voices[0].OpenID) {
							var lastestOpenId = (data.portalResp.Data.Voices[0].OpenID);
							var lastestImage = (data.portalResp.Data.Voices[0].ImageURL);
							var lastestVoiceID = (data.portalResp.Data.Voices[0].VoiceID);
							var lastestNickName = (data.portalResp.Data.Voices[0].NickName);
							voice.serverId = lastestVoiceID;
							wx.downloadVoice({
								serverId: voice.serverId,
								success: function(res) {
									voice.localId = res.localId;
									if (voice.localId == '') {
										alert('没有最新的语音信息！');
										return;
									}
									wx.playVoice({
										localId: voice.localId
									});
								}
							});
						} else {
							alert("没有最新的语音信息！");
						}
					});
				};*/
				// 4.8 监听录音播放停止
				wx.onVoicePlayEnd({
					complete: function(res) {
						//alert('录音（' + res.localId + '）播放结束');
					}
				});
				// 4.8 上传语音，界面上没有这个单独按钮了
				/*document.querySelector('#uploadVoice').onclick = function() {
					//alert("开始录音："+voice.localId);
					document.getElementById("stopRecordDiv").style.display = "none";
					document.getElementById("uploadVoiceDiv").style.display = "none";
					document.getElementById("startRecordDiv").style.display = "";
					if (voice.localId == '') {
						alert('请先使用 startRecord 接口录制一段声音');
						return;
					}
					wx.uploadVoice({
						localId: voice.localId,
						isShowProgressTips: 1, // 默认为1，显示进度提示
						success: function(res) {
							//alert('上传语音成功，serverId 为' + res.serverId);
							voice.serverId = res.serverId;
							uploadVoiceId(res.serverId);
						}
					});
				};*/
				//						    // 4.9 下载语音
				//							  document.querySelector('#downloadVoice').onclick = function () {
				//							  	voice.serverId = "OS3TSdDrGN9E4B0ozZhV72ckMWXhMmmYKIKaolmXa4RVhJktrlqjgcRuxJ0xAeR6";
				//							    if (voice.serverId == '') {
				//							      alert('请先使用 uploadVoice 上传声音');
				//							      return;
				//							    }
				//							    alert("语音ID:"+voice.serverId);
				//							    wx.downloadVoice({
				//							      serverId: voice.serverId,
				//							      success: function (res) {
				//							        alert('下载语音成功，localId 为' + res.localId);
				//							        voice.localId = res.localId;
				//							      }
				//							    });
				//							  };
			});
			wx.error(function(res) {
				alert(res.errMsg);
			});
		}
		var nickName, imageURL;

		function hiddenVoiceSession() {
			//document.getElementById("popup").style.display = "none";
		}

		function fetchVoiceList() {
			//document.getElementById("popup").style.display = "";
			var dataStr = {
				"TripID": parseInt(tripId, 10),
				"VoiceType": 1,
				"Cursor": 0,
				"Limit": 10,
				"OpenID": openId
			};
			bidgeToWeixin(openId, 'ListVoice', dataStr, function(data, status, xhr) {
				var voiceMsg = [],
					voices = data && data.portalResp && data.portalResp.Data && data.portalResp.Data.Voices;
				newsVoiceID = voices.length > 0 ? voices[voices.length - 1].VoiceID : '';
				$.each(voices, function(index) {
					var lastestOpenId = (voices[index].OpenID);
					var lastestImage = (voices[index].ImageURL);
					var lastestVoiceID = (voices[index].VoiceID);
					var lastestNickName = (voices[index].NickName);
					var createTime = (voices[index].createTime || '');
					if (lastestOpenId != openId) {
						/*voiceMsg += '<div class="call_group">';
						voiceMsg += '     <div class="fl"><img src="' + lastestImage + '" class="user_pic"></div>';
						voiceMsg += '     <a href="javascript:void(0);">';
						voiceMsg += '     <div class="fl message_area ml10">';
						voiceMsg += '          <p class="fl white_arrow"><img src="img/left_arrow_white.png"></p>';
						voiceMsg += '          <font onclick="startVoice(\'' + lastestVoiceID + '\')"><p class="fl white_message"><i class="iconfont gray">&#xe618;</i></p></font>';
						voiceMsg += '          <o class="fl message_time ml5"></p>';
						voiceMsg += '     </div>';
						voiceMsg += '     </a>';
						voiceMsg += '</div>';*/
						voiceMsg.push('<div class="call-item right">');
						voiceMsg.push('<span class="time">' + (createTime.replace('AM', '上午').replace('PM', '下午')) + '</span><span class="video" onclick="startVoice(\'' + lastestVoiceID + '\')"><i class="video-btn icon iconfont">&#xe605;</i><i class="video-text icon iconfont">&#xe60a;</i></span>');
						voiceMsg.push('<img src="' + lastestImage + '" />');
						voiceMsg.push('</div>');
					} else {
						/*voiceMsg += '<div class="call_group">';
						voiceMsg += '     <div class="fr"><img src="' + lastestImage + '" class="user_pic"></div>';
						voiceMsg += '     <a href="javascript:void(0);">';
						voiceMsg += '     <div class="fr message_area mr10">';
						voiceMsg += '          <p class="fr white_arrow"><img src="img/right_arrow_green.png"></p>';
						voiceMsg += '          <font onclick="startVoice(\'' + lastestVoiceID + '\')"><p class="fr green_message"><i class="iconfont white">&#xe617;</i></p></font>';
						voiceMsg += '          <o class="fr message_time mr5"></p>';
						voiceMsg += '     </div>';
						voiceMsg += '     </a>';
						voiceMsg += '</div>';*/
						voiceMsg.push('<div class="call-item">');
						voiceMsg.push('<img src="' + lastestImage + '" />');
						voiceMsg.push('<span class="video" onclick="startVoice(\'' + lastestVoiceID + '\')"><i class="video-text icon iconfont">&#xe60b;</i><i class="video-btn icon iconfont">&#xe605;</i></span><span class="time">' + (createTime.replace('AM', '上午').replace('PM', '下午')) + '</span>')
						voiceMsg.push('</div>');
					}
				});
				//document.getElementById("popup").style.height = (getPageSize()[1] - 120) + "px";
				//document.getElementById("popupMsg").innerHTML = voiceMsg;
				$('.up-list-content.new-conversation').html(voiceMsg.join(''));
			});
		}

		function fillTripInfo(openId, tripId) {
				var dataStr = {
					TripID: tripId
				};
				bidgeToWeixin(openId, 'TripDetail', dataStr, function(rdata, status, xhr) {
					var data = rdata && rdata.portalResp && rdata.portalResp.Data;
					$("#trip-title").html(data.Title);
					$("#txtJourneyDestination").html(data.Destination.Name);
					data.StartDate = data.StartDate || data.ValidDate;
					$('#txtJourneyStartTime').html(data.StartDate.length > 2 ? data.StartDate.substring(0, data.StartDate.length - 1) : data.StartDate);
					$("#txtJourneyEndTime").html(data.ValidDate.length > 2 ? data.ValidDate.substring(0, data.ValidDate.length - 1) : data.ValidDate);
					tripLeaderId = data.TripLeader;
					$('.friend-list-status .up-list-title-txt').html('参与人数：' + (data.MemberStatus.length || 0) + '人');
					tripStatus = data.status || tripStatus;
					$('#tripStatusBar').html(["旅程准备中", "旅程进行中", "旅程已结束"][parseInt(tripStatus || 0)]).removeClass('status_green greenline').addClass(["status_blue blueline", "status_green greenline", "status_gray grayline"][parseInt(tripStatus || 0)]);
					if (data.MemberStatus && data.MemberStatus.length > 0) {
						var memberStr = [];
						memberList = data.MemberStatus;
						$.each(data.MemberStatus, function(index) {
							memberList[index] = data.MemberStatus[index];
							//memberHashList[data.MemberStatus[index].OpenID]=data.MemberStatus[index];//用于获取好友信息的HASH队列
							if (data.MemberStatus[index].OpenID == data.TripLeader) {
								/*$("#mines").html("");
								$("#mines").html("<img src='" + data.MemberStatus[index].ImageURL + "'  class='user_pic'>");
								$("#nickname").html("");
								$("#nickname").html(data.MemberStatus[index].Nickname);*/
								$('#owner-name').html(data.MemberStatus[index].Nickname);
								$('.td1 img').attr({
									'src': data.MemberStatus[index].ImageURL
								});
							}
							if (data.MemberStatus[index].OpenID == openId) {
								nickName = data.MemberStatus[index].Nickname;
								imageURL = data.MemberStatus[index].ImageURL;
							}
							memberStr.push($('<div>').addClass('friend-items').data('user', data.MemberStatus[index])
								.append($('<img>').attr({
									'src': data.MemberStatus[index].ImageURL
								}))
								.append($('<span>').addClass('friend-items-info')
									.append($('<i>').addClass('friend-items-name').html(data.MemberStatus[index].Nickname))
									.append($('<i>').addClass('friend-items-status').html(data.MemberStatus[index].TripMemberStatus == "1" ? "在线" : "离线"))
								));
						});
						$('.up-list-content.friend-status').empty().append(memberStr);
					}
					mapInit(new AMap.LngLat(data.Destination.Loc.Longitude / 1000000, data.Destination.Loc.Latitude / 1000000));
					lat_me = data.Destination.Loc.Latitude / 1000000;
					lon_me = data.Destination.Loc.Longitude / 1000000;
					mapObj.setZoomAndCenter(15, new AMap.LngLat(data.Destination.Loc.Longitude / 1000000,
						data.Destination.Loc.Latitude / 1000000));
					/*if (tripLeaderId == openId) {
						document.getElementById("rightMenu").style.display = "";
					}*/
					closemaskLoading(); //关闭这招层
				});
			}
			/**
			 * 每次获取最新一条语音，ID号与上一次一致就不提醒，不一致就提醒
			 */

		function fetchVoiceListByLimit1() {
			var dataStr = {
				"TripID": parseInt(tripId, 10),
				"VoiceType": 1,
				"Cursor": 0,
				"Limit": 1,
				"OpenID": openId
			};
			bidgeToWeixin(openId, 'ListVoice', dataStr, function(data, status, xhr) {
				var voices = data && data.portalResp && data.portalResp.Data && data.portalResp.Data.Voices;
				newsVoiceID && voices.length > 0 && newsVoiceID == voices[voices.length - 1].VoiceID ?
					($('.btns-item-conversation').addClass('has-new'), newsVoiceID = voices[voices.length - 1].VoiceID) : $('.btns-item-conversation').removeClass('has-new');
			});
		}
		var soundRecordingCountDown = $('.btns-item-soundrecording .btn-name');
		/**
		 * 录音倒计时,注意结束时调用事件的顺序
		 * 此处为，调用alert前已经停止录音，点击确定后上传录音数据,同时改变按钮状态
		 */
		function updateCountdown() {
			var html = soundRecordingCountDown.html(),
				startIndex = html.indexOf('('),
				endIndex = html.indexOf(')'),
				strHTML = '';
			startIndex > -1 ? strHTML = html.substr(0, startIndex) : strHTML = html;
			soundRecordingCountDown.html(strHTML + '(' + (timeCountDown--) + ')');
			if (timeCountDown == -1) {
				//先调用停止录音事件,获取voiceid值
				wx.stopRecord({
					success: function(res) {
						voice.localId = (res && res.localId) || '';
						if (voice.localId == '') {
							alert('请先点击开始录音按钮录制一段声音');
							return;
						}
					},
					fail: function(res) {
						alert(JSON.stringify(res));
					}
				});
				//弹出提示信息窗口
				alert('已达到最长录音时间，录音自动停止。点击确定将自动提交语音。');
				//$('#startRecord').click();
				//点击确定后修改按钮状态，同时上传录音文件
				$('.btn-name', $('#startRecord')).html("录音");
				$('#startRecord').attr({
					'data-status': 'startrecord'
				});
				timeCountDown = 55;
				clearInterval(timeIntervalClock);
				wx.uploadVoice({
					localId: voice.localId,
					isShowProgressTips: 1, // 默认为1，显示进度提示
					success: function(res) {
						voice.serverId = res.serverId;
						uploadVoiceId(res.serverId);
					}
				});
			}
		}
		setLocation();
		setInterval(setLocation, 20000);
		setInterval(fetchVoiceListByLimit1, 60000); //每一分钟获取一次新的语音
	</script>

</html>